/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mlbs.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author mckd87
 */
@Entity
@Table(name = "challengequestion")
@NamedQueries({@NamedQuery(name = "Challengequestion.findByChallengeId", query = "SELECT c FROM Challengequestion c WHERE c.challengeId = :challengeId"), @NamedQuery(name = "Challengequestion.findByQuestion", query = "SELECT c FROM Challengequestion c WHERE c.question = :question")})
public class Challengequestion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "challengeId", nullable = false)
    private Integer challengeId;
    @Column(name = "Question")
    private String question;
    @OneToMany(mappedBy = "challengeId")
    private Collection<Usertable> usertableCollection;

    public Challengequestion() {
    }

    public Challengequestion(Integer challengeId) {
        this.challengeId = challengeId;
    }

    public Integer getChallengeId() {
        return challengeId;
    }

    public void setChallengeId(Integer challengeId) {
        this.challengeId = challengeId;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public Collection<Usertable> getUsertableCollection() {
        return usertableCollection;
    }

    public void setUsertableCollection(Collection<Usertable> usertableCollection) {
        this.usertableCollection = usertableCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (challengeId != null ? challengeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Challengequestion)) {
            return false;
        }
        Challengequestion other = (Challengequestion) object;
        if ((this.challengeId == null && other.challengeId != null) || (this.challengeId != null && !this.challengeId.equals(other.challengeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mlbs.entity.Challengequestion[challengeId=" + challengeId + "]";
    }

}
